package com.wlxk.base.common.exception;


import com.wlxk.base.common.constant.WlErrEnum;

/**
 * 通用异常类
 *
 * @author wlxk
 * @since 2021-11-04 11:18:38
 */
public class WlException extends RuntimeException {
    /**
     * 错误编码
     */
    private final Integer code;

    public WlException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public WlException(WlErrEnum errEnum) {
        super(errEnum.msg);
        this.code = errEnum.code;
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String toString() {
        return "GfwhBaseException{" + "code=" + code + ", message=" + this.getMessage() + '}';
    }
}
